using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_CURRENTadmisionMap : EntityTypeConfiguration<SO_CURRENTadmision>
    {
        public SO_CURRENTadmisionMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Latin_Last_Name, t.Arabic_Last_Name, t.ENTRY_DATE, t.Current_Admission, t.cid });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(10);

            this.Property(t => t.PATIENT_ID)
                .HasMaxLength(6);

            this.Property(t => t.CASE__)
                .HasMaxLength(15);

            this.Property(t => t.Latin_Name)
                .HasMaxLength(60);

            this.Property(t => t.Arabic_Name)
                .HasMaxLength(30);

            this.Property(t => t.Latin_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Arabic_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Entry_Type)
                .HasMaxLength(25);

            this.Property(t => t.Patient_Type)
                .HasMaxLength(10);

            this.Property(t => t.Phones)
                .HasMaxLength(30);

            this.Property(t => t.Nationality)
                .HasMaxLength(30);

            this.Property(t => t.Age_Y_M_D_)
                .HasMaxLength(10);

            this.Property(t => t.ADDRESS)
                .HasMaxLength(80);

            this.Property(t => t.Current_Admission)
                .IsRequired()
                .HasMaxLength(4);

            this.Property(t => t.cid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("SO_CURRENTadmision");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.PATIENT_ID).HasColumnName("PATIENT_ID");
            this.Property(t => t.CASE__).HasColumnName("CASE_#");
            this.Property(t => t.Latin_Name).HasColumnName("Latin_Name");
            this.Property(t => t.Arabic_Name).HasColumnName("Arabic_Name");
            this.Property(t => t.Latin_Last_Name).HasColumnName("Latin_Last_Name");
            this.Property(t => t.Arabic_Last_Name).HasColumnName("Arabic_Last_Name");
            this.Property(t => t.ENTRY_DATE).HasColumnName("ENTRY_DATE");
            this.Property(t => t.DISCHARGE_DATE).HasColumnName("DISCHARGE_DATE");
            this.Property(t => t.Entry_Type).HasColumnName("Entry_Type");
            this.Property(t => t.Patient_Type).HasColumnName("Patient_Type");
            this.Property(t => t.Phones).HasColumnName("Phones");
            this.Property(t => t.Nationality).HasColumnName("Nationality");
            this.Property(t => t.Age_Y_M_D_).HasColumnName("Age(Y:M:D)");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.Current_Admission).HasColumnName("Current_Admission");
            this.Property(t => t.cid).HasColumnName("cid");
        }
    }
}
